<?php
//------------------------
// 分类下品牌视图
//// platform_goods_cate , platform_goods_cate_brand , platform_goods_brand
//-------------------------
namespace app\common\model;

use think\Model;
use think\Db;

class GoodsCateBrandView extends Model{

    protected $table = 'platform_goods_cate';

    //自定义初始化
    protected function initialize()
    {
        parent::initialize();
        //TODO:自定义的初始化,连表
        $this->join('platform_goods_cate_brand','platform_goods_cate.id = platform_goods_cate_brand.cate_id','LEFT');

        $this->join('platform_goods_brand','platform_goods_cate_brand.brand_id = platform_goods_brand.id','LEFT');

        $this->field('platform_goods_brand.brand_name AS brand_name,platform_goods_brand.id AS brand_id,platform_goods_cate.cate_name AS cate_name');
    }
}